//
//  SpMoreModelCell.m
//  BobNews
//
//  Created by lanou3g on 16/5/7.
//  Copyright © 2016年 YJC. All rights reserved.
//

#import "SpMoreModelCell.h"
#import "UIImageView+WebCache.h"
#import "BigImageView.h"
@interface SpMoreModelCell ()

@property (weak, nonatomic) IBOutlet UILabel *titleLable;
@property (weak, nonatomic) IBOutlet UIImageView *leftImageView;

@property (weak, nonatomic) IBOutlet UIImageView *rightImageView;
@property (weak, nonatomic) IBOutlet UIImageView *centerImagView;

@end

@implementation SpMoreModelCell

-(void)layoutSubviews{
    
    [self.centerImagView sd_setImageWithURL:[NSURL URLWithString:self.model.imgextra[0][@"imgsrc"]]];
    [self.rightImageView sd_setImageWithURL:[NSURL URLWithString:self.model.imgextra[1][@"imgsrc"]]];
    [self.leftImageView sd_setImageWithURL:[NSURL URLWithString:self.model.imgsrc]];
    self.titleLable.text = self.model.title;
    
    self.leftImageView.userInteractionEnabled = YES;
    self.rightImageView.userInteractionEnabled = YES;
    self.centerImagView.userInteractionEnabled = YES;
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(rightImageViewAction:)];
    [self.rightImageView addGestureRecognizer:tap];
    
    UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(centerImagViewAction:)];
    [self.centerImagView addGestureRecognizer:tap2];
    
    UITapGestureRecognizer *tap3 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(leftImageViewAction:)];
    [self.leftImageView addGestureRecognizer:tap3];
    
}
- (void)rightImageViewAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.rightImageView];
}
- (void)centerImagViewAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.centerImagView];
}
- (void)leftImageViewAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.leftImageView];
}

+(CGFloat)height{
    
    return 130;
}

-(void)setModel:(SpMoreModel *)model{
    if (_model != model) {
        _model = model;
    }
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
